//
//  XHF_SmallTableViewCell.m
//  haojia
//
//  Created by 徐宏飞 on 16/4/16.
//  Copyright © 2016年 徐宏飞. All rights reserved.
//

#import "XHF_SmallTableViewCell.h"
#import "XHF_SmallCollectionViewCell.h"

@interface XHF_SmallTableViewCell ()<UICollectionViewDataSource, UICollectionViewDelegate>
@property (weak, nonatomic) IBOutlet UICollectionView *smallCollectionView;

@end

@implementation XHF_SmallTableViewCell

- (void)awakeFromNib {
    // Initialization code
    
    [self.smallCollectionView registerNib:[UINib nibWithNibName:@"XHF_SmallCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:@"SmallCollection"];
    
    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
    flowLayout.sectionInset = UIEdgeInsetsMake(4*WID, 4*WID, 4*WID, 4*WID);
    flowLayout.itemSize = CGSizeMake(90*WID, 90*WID);
    flowLayout.minimumLineSpacing = 5*WID;
    flowLayout.minimumInteritemSpacing = 5*WID;
    flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    self.smallCollectionView.collectionViewLayout = flowLayout;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return 10;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    
    
    XHF_SmallCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"SmallCollection" forIndexPath:indexPath];
    return cell;
}


-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
    
    NSLog(@"选中图片下标%ld", (long)indexPath.row);
    [self.myDelegate presntViewWithIndexPath:indexPath];
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
